package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.ReportDao;
import io.renren.dto.ReportDTO;
import io.renren.entity.ReportEntity;
import io.renren.service.ReportService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 报事
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class ReportServiceImpl extends CrudServiceImpl<ReportDao, ReportEntity, ReportDTO> implements ReportService {

    @Override
    public QueryWrapper<ReportEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<ReportEntity> wrapper = new QueryWrapper<>();

        String content = (String)params.get("content");
        wrapper.like(StringUtils.isNotBlank(content), "content", content);
        String contacts = (String)params.get("contacts");
        wrapper.like(StringUtils.isNotBlank(contacts), "contacts", contacts);
        String phone = (String)params.get("phone");
        wrapper.like(StringUtils.isNotBlank(phone), "phone", phone);
        String hid = (String)params.get("hid");
        wrapper.eq(StringUtils.isNotBlank(hid), "hid", hid);

        return wrapper;
    }


}